package com.example.demo.exception;

import com.example.demo.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice("com.example")
public class GlobalExceptionHandle {

    @ExceptionHandler(Exception.class)
    @ResponseBody //返回json格式
    public Result error(Exception e){
        e.printStackTrace();
        return Result.error();

    }
}
